/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package network.packets;

import utils.Utils;
/**
 *
 * @author Kvest
 */
public class TaxiParkingsLastChangeDateResponce extends Packet
{
    private long lastChange;
    
    public TaxiParkingsLastChangeDateResponce(byte[] data)
    {
        super(TAXI_PARKING_LAST_CHANGE_DATE_RESPONCE);
        lastChange = 0;

        parse(data);
    }

    protected void parse(byte[] data)
    {
        int offset = 0;

        //Пропускаем название пакета
        byte[] buffer4 = new byte[4];
        System.arraycopy(data, offset, buffer4, 0, buffer4.length);
        offset += buffer4.length + Utils.byteToInt(buffer4);
        
        //Дата последнего изменения стоянок на сервере
        byte[] buffer = new byte[8];
        System.arraycopy(data, offset, buffer, 0, buffer.length);
        offset += buffer.length;
        lastChange = Utils.byteToDate(buffer);
        
        buffer4 = null;
        buffer = null;
    }

    public long getLastChange()
    {
        return lastChange;
    }
}
